<html>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<meta http-equiv="Content-Language" content="en-us">
<link href="../edit68k.css" rel="stylesheet" type="text/css">
<title>Basic Operation</title>
<base target="_self">
</head>

<body class="text">

<p class="heading">Sim68K - Basic Operation<hr noshade></p>
<p></p>
<p>A 68000 program can be executed by starting the simulator manually and loading a 68000 S-Record (.S68) file or
by clicking the
&quot;Execute&quot; button after assembling a 68000 Source file in Edit68K. A batch file may also be used 
to automatically load and run a 
68000 .S68 file. See <a href="#batch">Running a Program From a Batch File</a> 
below. </p>

<p>
<img border="0" src="IMAGES/BasicOp/FileMenu.GIF"></p>
<p><b>Open</b> - Loads a 68000 program from S-Record (.S68) file into the 
simulator's 68000 memory space and initializes the simulator 
environment.</p>
<p><b>Open Data</b> - Loads a 68000 data from S-Record (.S68) file into the 
simulator's 68000 memory space without changing the simulator settings.</p>
<p><b>Close</b> - Clears the current program from the display.</p>

<p><b>Printer Setup...</b> - Setup the printer used for simulator 
output. See help for <a href="../textio.htm">Simulator I/O task 10</a> for more 
information.</p>

<p>Once you have loaded a program, the simulator will look similar to the
following window:</p>

<p>Note: If no matching &quot;Listing&quot; (.L68) file is available, no code
will display in the code window.</p>

<p>
<img border="0" src="IMAGES/BasicOp/SimMainwindow.GIF">&nbsp;</p>

<p>Set the Program Counter (PC) to the desired 
starting address by manually entering the address into the PC field or by double 
clicking on the desired line of program code. By default the PC is
set to the starting address of the program. You may also change any of the
68000's other registers at any time while the simulator is in Stop or Pause
mode.&nbsp; </p>
<p>All numbers in the registers are displayed using Hexadecimal notation
except the Status Register which is in Binary.</p>
<p>The registers displayed are as follows:</p>
<p><b>D0= ... D7=</b> Data registers<br>
<b>A0= ... A7=</b> Address registers<br>
<b>SR=</b> Status register<br>
<b>US=</b> User Stack (The user 
stack is the same as A7 
when the S bit in the Status Register is set to 0).<br>
<b>SS=</b> System Stack (The 
system stack is the same as A7 
when the S bit in the Status Register is set to 1).<br>
<b>PC=</b> Program Counter<br>
<br>
<b>Cycles</b> displays the estimated cycle time required for the previously 
executed instructions. The cycle counter does not take into account pipeline 
efficiencies. The cycle number displayed tends to be a worst case value and is 
only intended for relative comparison purposes. <a href="../simio.htm">Trap 
tasks 30 and 31</a> may be used to clear and read the cycle counter from 
a program.</p>

<p class="subheading"> 
<img border="0" src="IMAGES/BasicOp/RunBtn.GIF" width="23" height="22"> === Running a Program ===</p>
<p> 
To run the program, select Run from the Run Menu, press F9 or click the Run 
button on the toolbar. Sim68K begins executing the 68000 program at the current Program Counter location.
Program execution will continue until one of the following occurs:<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;- The program reaches a STOP instruction.<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;- The program reaches a user placed Break-Point<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;- The user Pauses the program.<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;- The user Resets the simulator.<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;- An exception occurs.</p>

<p class="subheading"><a name="batch"></a>=== Running a 
Program From a Batch File ===</p>
<p>Batch files may be used to start Sim68K, 
load a 68000 .S68 program and set several simulator options. The following 
command line arguments are recognized by Sim68K for this purpose:<br>
The first argument must be the name of the 68000 .S68 file to load followed by 
the optional arguments:<br>
<font face="Courier New">&nbsp; /f Full Screen <br>
&nbsp; /e Enable Exceptions <br>
&nbsp; /r Run<br>
&nbsp; /b Enable Bit Field Instructions</font><br>
For example, if a file named easyzone.bat is created that contains the following 
text:<br>
<font face="Courier New">&quot;c:\easy68k\SIM68K&quot; easyzone.s68 /r /f /e 
</font> 
<br>
The 68000 program easyzone.s68 would be loaded into Sim68K and run in full 
screen mode with exceptions enabled. This example assumes SIM68K is located in 
&quot;C:\easy68K&quot; and also assumes easyzone.s68 is located in the same folder as the 
batch file.</p>

<p class="subheading">
<img border="0" src="IMAGES/BasicOp/RunToBtn.GIF" width="23" height="22"> === Run To Cursor ===</p>
<p>

Program execution will continue until the Program Counter reaches the Cursor 
line (highlighted line) or until any of the stop conditions listed above in the 
Run command occurs.&nbsp; Run To Cursor 
may be selected from the Run Menu or by pressing 
Ctrl-F9 or by clicking the Run To Cursor button. </p>

<p class="subheading">=== Step and Trace ===</p>
<p>
<img border="0" src="IMAGES/BasicOp/TraceBtn.GIF" width="23" height="22">
<b>Trace Into</b> - Executes the current instruction and positions the Program Counter at the
next instruction to be executed. If the current instruction is a JSR or BSR the
program counter is placed at the first instruction of the subroutine.
To Trace through a program, select Trace Into from the Run Menu, press F7 or click
the Trace Into 
button.</p>
<p> 
<img border="0" src="IMAGES/BasicOp/StepBtn.GIF" width="23" height="22"> <b>Step Over</b> - Executes the current instruction and positions the Program Counter at the
instruction in the next line. If the current instruction is a JSR or BSR the
subroutine is completely executed and the Program Counter is placed at the
instruction following the JSR or BSR.
To Step through a program, select Step Over from the Run Menu, press F8 or click the
Step Over 
button.</p>
<p>
<img border="0" src="IMAGES/BasicOp/AutoTraceBtn.GIF" width="23" height="22"> <b>Auto Trace</b> - Automatically activates a Trace Into at the 
specified time interval. The time interval may be adjusted by selecting Auto 
Trace Options in the Options menu.
To start Auto Trace, select Auto Trace from the Run Menu, press F10 
or click the Auto Trace
button.</p>

<p>When Tracing or Stepping through a program, the next line to be
executed is highlighted as shown above.</p>

<p>The Auto Trace, Trace and Step buttons will be disabled if the program is
waiting for input.</p>

<p class="subheading"> <img border="0" src="IMAGES/BasicOp/PauseBtn.GIF" width="23" height="22"> === Pause ===</p>
<p> Pauses program execution and enables the menus.
To Pause a running program select Pause from the Run Menu, press F6 or click the
Pause button.</p>

<p class="subheading">
<img border="0" src="IMAGES/BasicOp/ResetBtn.GIF" width="23" height="22"> === 
Rewind 
Program ===</p>
<p>
Clears the Output Window, clears the 68000 registers and places the
Program Counter at the beginning of the program. To Rewind a program select 
Rewind Program from the Run Menu, press Ctrl+F2 or click the Rewind 
Program&nbsp;button.</p>

<p class="subheading">
<img border="0" src="IMAGES/BasicOp/ReloadBtn.GIF" width="23" height="22"> === Reload 
Program ===</p>
<p>
Reloads the last program into the 
simulator, clears the Output Window, clears the 68000 registers and places the
Program Counter at the beginning of the program.
To Reload a program select Reload Program from the Run Menu, press Ctrl+F3 or 
click the Reload Program&nbsp;button. </p>

<p class="subheading">
<img border="0" src="IMAGES/BasicOp/LogBtn.GIF" width="23" height="22"> === 
Start Log&nbsp; ===</p>
<p>
Starts logging. See <a href="SimOptions.htm">Options</a> for help on configuring 
the log types. <span style="font-weight: 700; background-color: #FFFF00">LOGGING</span> is 
displayed when logging is in progress.</p>
<p class="subheading">
<img border="0" src="IMAGES/BasicOp/StopLogBtn.GIF" width="23" height="22"> 
=== Stop Log&nbsp; ===</p>
<p>
Stops logging. See <a href="SimOptions.htm">Options</a> for help on configuring 
the log types.</p>
<p>&nbsp;</p>
<p class="subheading">=== View Menu ===</p>
<p>Use the View menu to select between the different Sim68K windows. You may also 
press Ctrl-Tab to cycle between the currently active simulator windows.</p>
<p style="text-indent: 0; word-spacing: 0; margin-left:0; margin-right:0">
<img border="0" src="IMAGES/BasicOp/SelOutputWindow.GIF"></p>
<p style="text-indent: 0; word-spacing: 0; margin-left:0; margin-right:0">&nbsp;</p>
<p class="subheading">=== Output Window ===</p>
<p style="text-indent: 0; word-spacing: 0; margin-left:0; margin-right:0">To see
what your program has displayed, select the View menu and then click
&quot;Output Window&quot;</p>
<p style="text-indent: 0; word-spacing: 0; margin-left:0; margin-right:0">
<img border="0" src="IMAGES/BasicOp/OutputWindowPic.gif"></p>
<p style="text-indent: 0; word-spacing: 0; margin-left:0; margin-right:0">The
output window also serves as a way to enter data into your program.&nbsp; See
<a href="../textio.htm">Text I/O</a></p>
<p>&nbsp;</p>
<p class="subheading">=== Simple breakpoints ===</p>
<p>A breakpoint is used to halt a 
program. You can place a simple breakpoint in the your program by
clicking the green dot next to the line of code you want to break at.</p>
<p>Once set, the dot will turn red as shown:</p>
<p>
<img border="0" src="IMAGES/basicop/Breaksimpleset.GIF"></p>
<p>You may clear the breakpoint by clicking the dot again.</p>
<p>&nbsp;When the program reaches the 
breakpoint it will halt prior to running the instruction at the breakpoint. The 
contents of the 68000 registers are displayed and may be modified. The program 
may be resumed using the Run button or using Trace and Step. The breakpoint 
remains active until removed.</p>
<p>
<img border="0" src="IMAGES/BasicOp/Breakhit.GIF" width="727" height="454"></p>

<p class="subheading">=== Embedding breakpoints in the source ===</p>
<p>Breakpoints may be embedded in the 68000 source file using the 
following form:</p>
<p class="text2">*[sim68k]break</p>
<p>Any source line that begins with the above text will 
automatically set a PC breakpoint on the following line of code when loaded into 
Sim68K.<br>
&nbsp;</p>

</body>

</html>